package com.itheima.demo02;

import java.util.ArrayList;
import java.util.Collection;

public class MainClass01 {
    public static void main(String[] args) {
        Collection<String> collection = new ArrayList<>();
        collection.add("aaa");
        collection.add("bbb");
        collection.add("ccc");
        collection.add("dddd");

        System.out.println(collection);
        method1(collection);
        method2(collection);
        method4(collection);
        method3(collection);
        method5(collection);
        method6(collection);

    }

    private static void method6(Collection<String> collection) {
        boolean empty = collection.isEmpty();
        System.out.println(empty);
    }

    private static void method5(Collection<String> collection) {
        collection.clear();
        System.out.println(collection);
    }

    private static void method3(Collection<String> collection) {
        boolean result = collection.contains("aaa");
        System.out.println(result);
    }

    private static void method4(Collection<String> collection) {
        collection.removeIf(
                (String s) -> {
                    return s.length() == 3;
                }
        );
        System.out.println(collection);
    }

    private static void method1(Collection<String> collection) {
        collection.remove("aaa");
        System.out.println(collection);
    }

    private static void method2(Collection<String> collection) {
        int size = collection.size();
        System.out.println(size);
    }
}
